<template>
    <div class="box">
        <!-- <van-nav-bar title="标题" fixed :placeholder="true"/> -->
        <baioti title="全部"></baioti>
        <van-search v-model="value" disabled placeholder="请输入搜索关键词" />

        <!-- <van-swipe :autoplay="3000" lazy-render>
            <van-swipe-item v-for="image in user" :key="image">
                <img :src="image.image_src" style="width: 100%;" />
            </van-swipe-item>
        </van-swipe> -->
        <lunbo :user="user"></lunbo>

        <van-grid :border="false" :column-num="2">
            <van-grid-item v-for="(v, i) in list" :key="i" @click="todelt(v.goods_id)">
                <van-image
                    :src="v.goods_big_logo ? v.goods_big_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg'" />
                <p>{{ v.goods_name }}</p>
                <p>${{ v.goods_price }}</p>
            </van-grid-item>
        </van-grid>

    </div>
</template>

<script setup>
import baioti from '@/components/baioti.vue';
import { searchApi } from '@/api/api';
import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'
import { swiperdataApi } from '@/api/api';
import lunbo from '@/components/lunbo.vue';
const images = [
      'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
      'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
    ];

let user=ref("")
const userlist=()=>{
    swiperdataApi().then(res=>{
        user.value=res.data.message
    })
}
userlist()

const router = useRouter()
const route = useRoute()
let list = ref("")
const getlist = () => {
    searchApi().then(res => {
        list.value = res.data.message.goods
    })
}
getlist()

const todelt = (goods_id) => {
    router.push({ path: '/detile', query: { goods_id: goods_id } })
}
</script>

<style lang="scss" scoped></style>